package cn.aoyu.test.aop;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @ClassName: SpringAopTestDemo
 * @Auther: xww
 * @Date: 2019/6/24 0024 17:42
 * @Description: 通过注解的方式来实现aop
 * @see org.springframework.aop.config.AopNamespaceHandler
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring-aop-anno.xml")
public class SpringAopAnnoTestDemo {

	private static ApplicationContext context = new ClassPathXmlApplicationContext("spring-aop-anno.xml");

	@Test
	public void testAop() {
		TestBean test = (TestBean) context.getBean("test");
		test.printTest();
	}

}
